import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random

import sim_creatures, ai, dungeon
from util import *

description = \
"""
The walls in this area are dotted with small holes about 8 inches in diameter.
Peering into one, you realize they aren't holes but rather tunnels. There's
something living in these walls. It can't be that big, but if it can eat
through solid rock it can certainly eat through you.
"""

class BurrowingWorm(sim_creatures.Monster):
    def __init__(self):
        sim_creatures.Monster.__init__(
            self,
            'burrowing worm',    # name
            parole.map.AsciiTile('w', colors['Black']), # symbol, color
            10,  # str
            7, # dex
            6,  # con
            18, # per
            8, # spd
            1,  # level
            10, # xp value
            False, # name starts with vowel? i.e., use "an" instead of "a"
            [],  # equipment slots
            'gore', # unarmed attack verb
            'die',  # death verb
            True,    # leaves corpse?
            1200, # unarmed attack energy
            description,
            bloodClass=sim_creatures.GreenBlood,
            brain=ai.TunnelBrain(self, ai.defaultStateMap, 
                digVerb="bores through", replacementObjClass=BoredRock),
        )

    def blockedBy(self, obj):
        if isinstance(obj, BoredRock):
            return False
        return super(BurrowingWorm, self).blockedBy(obj)

class BoredRock(dungeon.Rock):
    def __init__(self, baseRock):
        super(BoredRock, self).__init__('worm-bored rock', baseRock.layer,
                parole.map.AsciiTile('o', colors['Brown'],
                    bg_rgb=baseRock.shader.bg_rgb), blockLOS=False,
                blockMove=baseRock.blocksMove, massNoun=baseRock.massNoun,
                startsVowel=baseRock.startsVowel, blocksNonCorporeal=False)


#========================================
thingClass = BurrowingWorm

